home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-09-04 | 1.3 KB | 41 lines | [TEXT/CCL ] |
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; Copyright 1987, 1988, 1989, 1990 by Ruben Kleiman for Apple Computer, Inc.
- ;;; Advanced Technology Group
- ;;;
-
- (require :traps)
-
- (provide :play-snd)
-
- (in-package 'sound)
-
- (export '(play-snd))
-
- (defun play-snd (soundName &key (synthType sampledSynth) resFileName
- &aux resFileRefNum resHandle)
- "Plays an snd resource on a selected synthetizer channel"
- (%stack-block ((channel 4))
- (%put-long channel 0 0)
-
- ;; Load any resource file
- (when resFileName
- (with-pstrs ((PascalFileName resFileName))
- (if resFileName
- (if (= -1 (setq resFileRefNum (_openResFile :ptr PascalFileName :word)))
- (error "Resource file ~a could not be opened." resFileName)))))
-
- ;; Load the snd resource
- (with-pstrs ((PascalResName soundName))
- (setq resHandle (_getNamedResource :word #x6420 :word #x736e :ptr PascalResName :ptr))
- (_detachresource :ptr resHandle))
-
- (_SndNewChannel :ptr channel :word synthType :long 'y :ptr nil :word)
-
- (_SndPlay :ptr (%get-ptr channel 0) :ptr resHandle :word -1 :word)
-
- (_SndDisposeChannel :ptr (%get-ptr channel 0) :word 0))
-
- (if resFileRefNum
- (_closeResFile :word resFileRefNum)))
-
-